package com.example.springboottools.vpapi;

import cn.hutool.http.HttpRequest;
import com.example.springboottools.utils.ReadExcel;

import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

public class StmDataApi {
     final static   String prodUrl = "https://stbsrm.stbchina.cn/api/statement/settlement/StmDataCtr/deleteStmData";

    public static void main(String[] args) {
//        Map<String, Object> map = new HashMap<>();
//        map.put("stmCode","NB0120247000431059");
//        map.put("status","12");
//        String url = "http://10.10.5.80/api/statement/settlement/StmDataCtr/deleteStmData";
//        String prodUrl = "https://stbsrm.stbchina.cn/api/statement/settlement/StmDataCtr/deleteStmData";
//        String body = HttpRequest.post(prodUrl).header("access-token", "2e0793a89a4942eea908e1da44781c0820240830101232")
//       //String body = HttpRequest.post(prodUrl).header("access-token", "0de3e2aa7e024936aacc0b90d6fcaba720240830094033")
//                .header("Content-Type", "application/x-www-form-urlencoded")
//                //.form("stmCode","NB0120247000431059")
//                //.form("status","12")
//                .form(map)
//                .execute().body();
//        System.out.println("args = " + body);
        String path = "D:\\staples\\日常记录\\工作记录\\2024\\08\\30\\V8\\V8-stm-code.xls";
        File excelFile = new File(path);
        String[] nameStr = {"stm_code"};
        List<Map<String, Object>> excelMapList = ReadExcel.readExcel1(excelFile, nameStr, 1, 0);
        AtomicInteger i = new AtomicInteger(1);
        excelMapList.forEach(map -> {
           String stmCode = map.get("stm_code").toString();
           String body = HttpRequest.post(prodUrl).header("access-token", "2e0793a89a4942eea908e1da44781c0820240830101232")
                   .form("stmCode",stmCode)
                   .form("status","12").execute().body();
           System.out.println("stmCode = " + stmCode+"执行结果：" + body);
            System.out.println("args =当前执行数量 " + (i.getAndIncrement()));
        });


    }
}
